package com.copsoftware.comun.assemblers;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;

import com.copsoftware.comun.beans.PersonaFlt;
import com.copsoftware.entity.DenPersonaImpl;
import com.copsoftware.mantenimientos.persona.beans.PersonaCompletaFlt;
import com.copsoftware.procesos.investigacion.bean.AcusadoFormFilt;
import com.copsoftware.procesos.investigacion.bean.ExpertoFormFilt;
import com.copsoftware.procesos.investigacion.bean.TestigoFormFilt;
import com.copsoftware.struts.forms.BusquedaPersonaForm;
import com.copsoftware.struts.forms.BusquedaRapidaPersonaForm;
import com.copsoftware.struts.forms.RegistrarDenunciaForm;
import com.copsoftware.struts.forms.RegistrarInvestigacionForm;

public class PersonaAssembler {

	public static PersonaFlt createPersonaFlt(BusquedaRapidaPersonaForm form) {
		PersonaFlt personaFlt = new PersonaFlt();
		BeanWrapper bW = new BeanWrapperImpl(true);
		String tipoPersona = form.getTipoPersona();
		personaFlt.setTipoPersona(tipoPersona);		
		BeanUtils.copyProperties(form,personaFlt,new String []{"tipoPersona"});
		return personaFlt;
	}
	
	public static PersonaFlt createPersonaDenFlt(RegistrarDenunciaForm form) {
		PersonaFlt personaFlt = new PersonaFlt();
		BeanWrapper bW = new BeanWrapperImpl(true);
		
		personaFlt.setCodigo(String.valueOf(form.getCPersonal()));
		personaFlt.setNombre(form.getXPersonal());
		personaFlt.setTipoPersona(String.valueOf(DenPersonaImpl.TIPO_PERSONA_PERSONAL));
		
				
		BeanUtils.copyProperties(form,personaFlt,new String []{"tipoPersona"});
		return personaFlt;
	}
	

	public static PersonaCompletaFlt createPersonaCompletaFlt(BusquedaPersonaForm form) {
		PersonaCompletaFlt personaCompletaFlt= new PersonaCompletaFlt();
		BeanUtils.copyProperties(form, personaCompletaFlt);
		return personaCompletaFlt;
	}
	
	public static PersonaCompletaFlt createPersonaCompletaFlt(RegistrarInvestigacionForm form) {
		PersonaCompletaFlt personaCompletaFlt= new PersonaCompletaFlt();
		BeanUtils.copyProperties(form, personaCompletaFlt);
		return personaCompletaFlt;
	}
	
	public static PersonaCompletaFlt createPersonaCompletaFlt(AcusadoFormFilt form) {
		PersonaCompletaFlt personaCompletaFlt= new PersonaCompletaFlt();
		BeanUtils.copyProperties(form, personaCompletaFlt);
		return personaCompletaFlt;
	}
	
	public static PersonaCompletaFlt createPersonaCompletaFlt(TestigoFormFilt form) {
		PersonaCompletaFlt personaCompletaFlt= new PersonaCompletaFlt();
		BeanUtils.copyProperties(form, personaCompletaFlt);
		return personaCompletaFlt;
	}
	
	public static PersonaCompletaFlt createPersonaCompletaFlt(ExpertoFormFilt form) {
		PersonaCompletaFlt personaCompletaFlt= new PersonaCompletaFlt();
		BeanUtils.copyProperties(form, personaCompletaFlt);
		return personaCompletaFlt;
	}
}
